package com.bosssoft.cloud.wechat.common.infra.properties;

import com.bosssoft.cloud.wechat.common.bean.sms.SmsDTO;
import com.bosssoft.cloud.wechat.common.infra.properties.EipsProperties;
import com.bosssoft.cloud.wechat.common.infra.properties.SmsProperties;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * eips配置信息管理类
 *
 * @author wcy create on 2021/6/29 11:51 上午
 */
@Component
public class EipsManager {
    @Resource
    private SmsProperties smsProperties;
    @Resource
    private EipsProperties eipsProperties;

    /**
     * 获取当前使用的短信开放平台info
     *
     * @return sms info
     */
    public SmsDTO getSms() {
        for (SmsDTO sms : smsProperties.getProvider()) {
            if (sms.getId().equals(smsProperties.getActive())) return sms;
        }
        return new SmsDTO();
    }

    public String getLocalAreaCode() {
        return eipsProperties.getCaizheng().getLocalAreaCode();
    }

    public String getDownloadtype() {
        return eipsProperties.getCaizheng().getDownloadtype().toUpperCase();
    }

}
